const path = require('path')
const Webpack = require('webpack')
const { merge } = require('webpack-merge')
const common  = require('./webpack.common')

module.exports = merge(common, {
  mode: 'development',
  devtool: 'cheap-module-eval-source-map',
  devServer: {
    port: 8080,
    open: true, // 在启用webpack-dev-server时，自动打开浏览器
    hot: true,
    overlay: {
      errors: true // 将webpack编译的错误显示在网页上面
    },
    contentBase: [
      path.join(__dirname, "public")
    ]
  },
  plugins: [
    new Webpack.HotModuleReplacementPlugin(),
  ]
})
